#include "AC33Mxxx_conf.h"



// GPIO
CSP_GPIO_T		* const		GPIO_A		= (CSP_GPIO_T *) GPIO_A_BASE_ADDRESS; 
CSP_GPIO_T		* const		GPIO_B		= (CSP_GPIO_T *) GPIO_B_BASE_ADDRESS; 
CSP_GPIO_T		* const		GPIO_C		= (CSP_GPIO_T *) GPIO_C_BASE_ADDRESS; 
CSP_GPIO_T		* const		GPIO_D		= (CSP_GPIO_T *) GPIO_D_BASE_ADDRESS; 



/**
************************************************************************************
* @ Name : CSP_GPIO_OutputHigh
*
* @ Parameter
*		- gpio		= GPIO_A, GPIO_B, GPIO_C, GPIO_D, GPIO_E, GPIO_F, GPIO_G
*		- pin_no		= PIN_0, PIN_1, ..., PIN_7
*
*
************************************************************************************
*/
void CSP_GPIO_OutputHigh (CSP_GPIO_T * const gpio, UINT32 pin_no)
{

	UINT32 	reg_val; 

	//---------------------------------------------------------------------------
	// bit set 
	//
	// 					BABSR		@ address = 0x4000_2008
	// 					BBBSR		@ address = 0x4000_2108
	// 					BCBSR		@ address = 0x4000_2208
	// 					BDBSR		@ address = 0x4000_2308
	// 					BEBSR		@ address = 0x4000_2408
	// 					BFBSR		@ address = 0x4000_2508
	// 					BGBSR		@ address = 0x4000_2608
	//
	//---------------------------------------------------------------------------
	reg_val = (0x0001<<pin_no); 
	CSP_GPIO_SET_PnBSR(gpio, reg_val); 

}



/**
************************************************************************************
* @ Name : CSP_GPIO_OutputLow 
*
* @ Parameter
*		- gpio		= GPIO_A, GPIO_B, GPIO_C, GPIO_D, GPIO_E, GPIO_F, GPIO_G
*		- pin_no		= PIN_0, PIN_1, ..., PIN_7
*
*
************************************************************************************
*/
void CSP_GPIO_OutputLow (CSP_GPIO_T * const gpio, UINT32 pin_no)
{

	UINT32 	reg_val; 


	//---------------------------------------------------------------------------
	// bit clear 
	//
	// 					BABCR		@ address = 0x4000_200C
	// 					BBBCR		@ address = 0x4000_210C
	// 					BCBCR		@ address = 0x4000_220C
	// 					BDBCR		@ address = 0x4000_230C
	// 					BEBCR		@ address = 0x4000_240C
	// 					BFBCR		@ address = 0x4000_250C
	// 					BGBCR		@ address = 0x4000_260C
	//
	//---------------------------------------------------------------------------
	reg_val = (0x0001<<pin_no); 
	CSP_GPIO_SET_PnBCR(gpio, reg_val); 


}


